from flask import Flask, request, url_for, redirect
from datetime import timedelta


app = Flask(__name__)
app.config["SEND_FILE_MAX_AGE_DEFAULT"] = timedelta(seconds=2)


@app.route("/hello/<name>", methods=["GET"])
def index(name):
    # url_for是通过函数名找对应的url，如果带有参数，就在后面使用键值对的形式传递
    return redirect(url_for("news", news_id=20))

@app.route("/news/<news_id>", methods=["GET"])
def news(news_id):
    print(news_id)
    return f"Hello News...{news_id}"





if __name__ == "__main__":
    app.run(debug=True)